/* 
 * File:   ServerDataClasses.h
 * Author: Jakub Machoń
 *
 * Created on 30 maj 2010, 15:41
 */

#ifndef _SERVERDATACLASSES_H
#define	_SERVERDATACLASSES_H

enum TReadType {
    ENormal, EExclusive
};

enum TFilterOperator {
    EQUAL, GREATER, GREATER_OR_EQUAL, LESS, LESS_OR_EQUAL, ANY
};

class TFilter {
public:
    inline TFilter(const TFieldType aType, const TFilterOperator aFilterOperator, const std::string aFilterInfo) :
        type(aType), filterOperator(aFilterOperator), filterInfo(aFilterInfo) {
    }
    
    inline const TFieldType getType() const {
        return type;
    }

    inline const TFilterOperator getFilterOperator() const {
        return filterOperator;
    }

    inline const std::string getFilterInfo() const {
        return filterInfo;
    }

private:
    TFieldType type;
    TFilterOperator filterOperator;
    std::string filterInfo;
};

class TClient {
public:
    TClient(const TReadType aReadType, const int aQueueId, const int aTimeout,
            const boost::shared_ptr<std::list<TFilter> > aFilter) :
        readType(aReadType), queueId(aQueueId), timeout(aTimeout), filter(aFilter) {
    }

    inline const TReadType getReadType() const {
        return readType;
    }

    inline const int getQueueId() const {
        return queueId;
    }

    inline const boost::posix_time::ptime getTimeoutTime() const {
        return timeoutTime;
    }

    inline void setTimeoutTime(boost::posix_time::ptime aTimeoutTime) {
        timeoutTime=aTimeoutTime;
    }

    inline const int getTimeout() const {
        return timeout;
    }

    inline const boost::shared_ptr<std::list<TFilter> > getFilter() const {
        return filter;
    }

private:
    const TReadType readType;
    int queueId;
    boost::posix_time::ptime timeoutTime;
    int timeout;
    boost::shared_ptr<std::list<TFilter> > filter;
};

#endif	/* _SERVERDATACLASSES_H */

